package com.lz.football.module.activity
{
	import com.global.GlobalDef;
	
	import common.BaseView.BaseView;
	
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;

	/**
	 * 活动基础类
	 * 实现单个面板加载 
	 * @author Administrator
	 * 
	 */	
	public class ActivityBase extends BaseView//Sprite implements IComponent
	{
		/**
		 *加载器 
		 */
		private var _loader:Loader;
		public function ActivityBase()
		{
			super();
		}
		/**
		 *加载资源 
		 * @param $str
		 * 
		 */
		public function loadRes($str:String):void
		{
			var str:String = $str + GlobalDef.ReleaseVersion;
			_loader = new Loader();
			_loader.load(new URLRequest(str),new LoaderContext(false,ApplicationDomain.currentDomain));
			_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteHandler);
			_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,loaderErrorHandler);
		}
		
		/**
		 *加载错误 
		 * @param event
		 * 
		 */
		protected function loaderErrorHandler(event:IOErrorEvent):void
		{
			_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadCompleteHandler);
			_loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,loaderErrorHandler);
			_loader = null;
		}
		
		/**
		 *加载完成 
		 * @param event
		 * 
		 */
		protected function loadCompleteHandler(event:Event):void
		{
			
			loaderErrorHandler(null);
			config();
		}
		/**
		 * 
		 * 
		 */
		public function config():void
		{
			
		}
		
//		public function initUI(view:Object=null):void
//		{
//		}
//		
//		public function addEvtListener():void
//		{
//		}
//		
//		public function removeEvtListener():void
//		{
//		}
//		
//		public function destroyView():void
//		{
//		}
	}
}